use std::path::Path;
use std::fs::{File, OpenOptions};
use std::io::Write;

#[test]
fn file_test() {
    let path = Path::new("test.txt");
    let result = if path.exists() { true } else { false };
    let mut file: File;
    if !result {
        file = File::create(&path).expect("Create File Error");
    } else {
        file = OpenOptions::new().append(true).open(&path).expect("Don't open file");
    }

    file.write_all("Write file test!\n".as_bytes()).expect("Write file failed!");
}
